package com.wei.news.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.wei.base.base.BaseActivity;
import com.wei.base.base.BasePresenter;
import com.wei.base.utils.BaseHandler;
import com.wei.news.R;
import com.wei.news.config.Config;

import java.util.concurrent.TimeUnit;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

/**
 * 作者：赵若位
 * 时间：2018/8/2 17:03
 * 邮箱：1070138445@qq.com
 * 功能：新闻收藏页面
 */
public class SplashActivity extends BaseActivity
{

    @Override
    protected BasePresenter createPresenter()
    {
        return null;
    }

    @Override
    protected int getResourceId()
    {
        return R.layout.activity_splash;
    }

    @Override
    public void initView(Bundle savedInstanceState)
    {
        super.initView(savedInstanceState);
        //关闭导航栏
        final View decorView = getWindow().getDecorView();
        final int uiOption = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_IMMERSIVE
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOption);


        new BaseHandler().postDelayed(new Runnable()
        {
            @Override
            public void run()
            {
                startActivity(new Intent(SplashActivity.this, MainActivity.class));
                doFinish();
            }
        }, Config.LONG_SPLASH_DELAY);

//        Observable.just(1)
//                .delay(3000, TimeUnit.MILLISECONDS)
//                .subscribeOn(Schedulers.io())
//                .observeOn(AndroidSchedulers.mainThread())
//                .subscribe(new Consumer<Integer>()
//                {
//                    @Override
//                    public void accept(Integer integer) throws Exception
//                    {
//
//                    }
//                });
    }
}
